Post

Replies

Boosts

Views

Activity

Customizing Swipe to Delete Button
Hi, Im trying to customize the button that appear when swiping a for each list for deleting trying to show a red circle and a white trash icon inside it, but instead I get a white empty button ? .swipeActions(edge: .trailing) { Button { deletePatient(patient: patient) } label: { ZStack { Circle() .fill(Color.red) .frame(width: 50, height: 50) Image(systemName: "trash") .foregroundColor(.white) } } .tint(.white) }
Topic: UI Frameworks SubTopic: SwiftUI
3
1
481
Jan ’25
SwiftuI view Error
Hi Im copying the Apple tutorial project for lists and navigation for SWiftUI but Im getting an error although my code is same as Apple project, can some one check please. Error "Cannot find 'landmarks' in scope" Kindest Regards import SwiftUI struct LandmarkRow: View {     var landmark: Landmark     var body: some View {         HStack {             Text(landmark.name)         }     } } struct LandmarkRow_Previews: PreviewProvider {     static var previews: some View {         LandmarkRow(landmark: landmarks[0])     } } import Foundation import SwiftUI import CoreLocation struct Landmark: Hashable, Codable {     var id: Int     var name: String     var park: String     var state: String     var description: String          private var imageName: String     var image: Image {         Image(imageName)     }          private var coordinates: Coordinates          var locationCoordinate: CLLocationCoordinate2D {         CLLocationCoordinate2D (             latitude: coordinates.latitude,             longitude: coordinates.longitude)     }          struct Coordinates: Hashable, Codable {         var latitude: Double         var longitude: Double     }      }
2
0
1k
Oct ’21
placeholderText Color
Hi Theres colors to use in SwiftUI when developing iOS App such as first line, but when I try to use the other system color placeholderText I get the error "Type Color? has no member placeholderText" why ? Text("Hello, World!").foregroundColor(.quaternaryLabel)
3
0
652
Jun ’22
NavigationSplitView Collapse Button
Hi, When creating a 3 columns Split View in SwiftUI the second view that resemble the mails list in Apple Mails App have a blue icon at top left corner where when tapped shows the column of Mail boxes such as Inbox, Sent etc. This icon by default when creating the Split View disappears after tapping, it shows the third column and disappear , I would like it to stay so I can show and collapse the first column sam as Apple Mail App. how to do that ? its called back also how to rename it and add icon to it ?
3
0
1.1k
Dec ’23
Adding multi view to NavigationPath in one go
Hi How can we add multi view to NavigationPath in one go like in code below maybe using something like path.append(mobiles.all) ? where all 3 views of mobiles Array get added at once ? Kindest Regards `struct NavigationPathView: View { var mobiles: [Mobiles] = [.init (name: "iPhone", imageName: "folder", color: .mint), .init (name: "Samsung", imageName: "pin", color: .pink), .init (name: "Mac Pro", imageName: "book", color: .gray)] @State var path = NavigationPath() var body: some View { NavigationStack (path: $path) { List { Section ("Platforms") { Button("Go To Platform") { path.append(mobiles.first!) } Button("Go To Mobile") { path.append(mobiles.last!) } Button("Add All Mobiles") { } } } } .navigationDestination(for: Mobiles.self) {mobile in ZStack { mobile.color.ignoresSafeArea() VStack { Image(systemName: mobile.imageName) Label (mobile.name, systemImage: mobile.imageName) .font(.largeTitle).bold().foregroundColor(.white) Button("Go Home") { path.removeLast(path.count) } } } } } }
2
0
525
Jun ’24